package com.lwm.controller;

import com.lwm.domain.FactoryDetail;
import com.lwm.domain.ResponseResult;
import com.lwm.service.FactoryDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 工厂建模明细控制层
 */
@RestController
@RequestMapping("/factoryDetail")
@Slf4j
public class FactoryDetailController {
    @Resource
    private FactoryDetailService factoryDetailService;

    /**
     * 保存
     *
     * @param factoryDetail 工厂建模明细
     * @return {@link ResponseResult}<{@link Object}>
     */
    @PostMapping
    public ResponseResult<Object> save(@RequestBody FactoryDetail factoryDetail) {
        log.info("save factoryDetail {}", factoryDetail);
        return factoryDetailService.save(factoryDetail);
    }

    /**
     * 删除
     *
     * @param detailIds 详细id
     * @return {@link ResponseResult}<{@link Object}>
     */
    @DeleteMapping
    public ResponseResult<Object> remove(@RequestBody List<Long> detailIds) {
        log.info("remove detailIds {}", detailIds);
        return factoryDetailService.remove(detailIds);
    }
}
